package out1;

import java.util.Arrays;
class Solution {

        public static  int mySqrt(int x) {
            int left=1;
            int right=x;
            int target=0;
            int mid=0;

            while(left<=right)
            {
                mid=(left+right)/2;

                if((long)mid*mid<=x)
                {
                    target=mid;
                    left=mid+1;

                }
                else
                {
                    right=mid-1;

                }
            }
            return target;



        }








    public static void main(String[] args) {
        //int[]arr={7,9,9};
        int b=mySqrt(9);
        System.out.println(b);

    }
}





















